<script>
import lotteryApi from "../api/lottery.api";
const state = {
  prizeList: [],
  lotteryResult: {}
};
const getters = {
  prizeList: state => state.prizeList,
  lotteryResult: state => state.lotteryResult
};
const mutations = {
  SetPrizeList(state, { prizeList }) {
    state.prizeList = prizeList;
  },
  SetLotteryResult(state, { lotteryResult }) {
    state.lotteryResult = lotteryResult;
  }
};
const actions = {
  getPrizeList({ commit }) {
    let result = lotteryApi.getPrizeList();
    commit("SetPrizeList", { prizeList: result });
  },
  lottery({ commit }) {
    let result = lotteryApi.lottery();
    commit("SetLotteryResult", { lotteryResult: result });
  }
};

export default {
  state,
  getters,
  mutations,
  actions,
  namespaced: true
};
</script>
